<script type="text/javascript" charset="utf-8" src="__PUBLIC__/admin/js/uploadify/jquery.uploadify.min.js" ></script>
<link rel="stylesheet" charset="utf-8" type="text/css" href="__PUBLIC__/admin/js/uploadify/uploadify.css"> 
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/admin/js/upload.js" ></script>
<!-- 配置文件 -->
<script type="text/javascript" src="__PUBLIC__/admin/js/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__PUBLIC__/admin/js/ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('edit');
</script>

<style>
.bg{ background: none; border: none;}
.uploadify-button-text{ display: inline-flex; }
.uploadify-button-text button{ margin: -10px; }
.upviewer img{ height:90px; width: 120px; }
.upviewer ul{ margin:0px; padding:0px; }
.upviewer li{ margin:0px; padding:0px; position: relative; display:inline-block; width:120px; height:90px; background-position: center; background-size: contain; background-repeat: no-repeat; float: left; margin-right:10px; border:1px #ccc solid; background-color:#f0f0f0;}
.upviewer li a{ display:inline-block; position: absolute; bottom:0px; left:0px; text-align:center; width:100%; background-color:rgba(0,0,0,0.3); color:red; cursor: pointer; }
.upviewer li:hover a{ background-color:rgba(0,0,0,0.8); }
</style>
<div class="container" style="padding-top: 50px;">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <form class="form-horizontal" role="form" method="post" id="post_form" action="{:U('')}">
               <!--  <div class="form-group">
                     <label for="url" class="col-sm-2 control-label">链接地址:</label>
                    <div class="col-sm-2">
                        <input type="text" class="form-control" name="url" id="url" value="{$info.url}" />
                    </div>
                </div>
                 -->
                <div class="form-group">
                     <label for="goods_name" class="col-sm-2 control-label">商品名称:</label>
                    <div class="col-sm-2">
                        <input type="text" class="form-control" name="goods_name" id="goods_name" value="{$info.goods_name}" />
                    </div>
                </div>
                <div class="form-group">
                     <label for="inputPassword3" class="col-sm-2 control-label">轮播图图片(640x200):</label>
                    <div class="col-sm-10 js_upload_img">
                        <input type="file" class="form-control" id="img" placeholder="图片"><br />          
                        <div name="img" class="upviewer" >
                            <ul>
                                <notempty name="info['img']">
                                    <php>
                                        $info['img'] = json_decode($info['img']) ;
                                    </php>
                                    <volist name="info['img']" id="vo">
                                        <li>
                                            <img src="{$vo}"/><a d_path="{$vo}">删除</a>
                                        </li>
                                    </volist>
                                </notempty>
                            </ul>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                         <input type="hidden" name="id" value="{$info.id}">
                         <button type="button" id="btn" class="btn btn-primary button">保存</button>
                    </div>
                </div>
            </form>
        </div>
</div>
</div>
<script>
$(function(){
    $("#btn").click(function(){
        // 省市区
        var $form = $("#post_form");
        var $data = {};
        var $form_data = $form.serializeArray();
        $.each($form_data, function(k, v){
            $data[v['name']] = v['value'];
        })
        
        $.post($form.attr('action'), $data, function(obj){
            alert(obj.m);
            if(obj.s){
                if(typeof(obj.url)!= "undefined" && obj.url){
                    location.href = obj.url;
                }
            }
        })
        return false;
    })
});
</script>
